package com.qf.day03;

import java.util.Scanner;

/**
 * 循环录入5个人人的成绩，求最大成绩、最小成绩、平均成绩
 */
public class Dome1 {
    public static void main(String[] args) {
        Scanner sc =new Scanner(System.in);
        System.out.println("请输入第一位同学成绩 ");
        double first =sc.nextDouble();  //录入成绩
        double maxAch= first; //最大成绩
        double minAch =first;   //最小成绩
        double sum =first;  //总分数
        for (int i = 1; i <=4 ; i++) {
            System.out.println("请输入第"+(i+1)+"为位同学成绩");
            double achievement =sc.nextDouble();  //录入成绩
            sum = sum + achievement;    //计算总分数
            if(achievement > maxAch){  //最大成绩
                maxAch =achievement;
            }else if(minAch > achievement){ //最小成绩
                minAch =achievement;
            }
        }
        System.out.println("最大成绩是："+maxAch);
        System.out.println("最小成绩是："+minAch);

        System.out.println("平均成绩是："+sum/5);
    }
}
